4 research outputs found
Path and Ancestor Queries over Trees with Multidimensional Weight Vectors
We consider an ordinal tree T on n nodes, with each node assigned a d-dimensional weight vector w in {1,2,...,n}^d, where d in N is a constant. We study path queries as generalizations of well-known {orthogonal range queries}, with one of the dimensions being tree topology rather than a linear order. Since in our definitions d only represents the number of dimensions of the weight vector without taking the tree topology into account, a path query in a tree with d-dimensional weight vectors generalize the corresponding (d+1)-dimensional orthogonal range query. We solve {ancestor dominance reporting} problem as a direct generalization of dominance reporting problem, in time O(lg^{d-1}{n}+k) and space of O(n lg^{d-2}n) words, where k is the size of the output, for d >= 2. We also achieve a tradeoff of O(n lg^{d-2+epsilon}{n}) words of space, with query time of O((lg^{d-1} n)/(lg lg n)^{d-2}+k), for the same problem, when d >= 3. We solve {path successor problem} in O(n lg^{d-1}{n}) words of space and time O(lg^{d-1+epsilon}{n}) for d >= 1 and an arbitrary constant epsilon > 0. We propose a solution to {path counting problem}, with O(n(lg{n}/lg lg{n})^{d-1}) words of space and O((lg{n}/lg lg{n})^{d}) query time, for d >= 1. Finally, we solve {path reporting problem} in O(n lg^{d-1+epsilon}{n}) words of space and O((lg^{d-1}{n})/(lg lg{n})^{d-2}+k) query time, for d >= 2. These results match or nearly match the best tradeoffs of the respective range queries. We are also the first to solve path successor even for d = 1
Path Query Data Structures in Practice
We perform experimental studies on data structures that answer path median,
path counting, and path reporting queries in weighted trees. These query
problems generalize the well-known range median query problem in arrays, as
well as the orthogonal range counting and reporting problems in planar
point sets, to tree structured data. We propose practical realizations of the
latest theoretical results on path queries. Our data structures, which use tree
extraction, heavy-path decomposition and wavelet trees, are implemented in both
succinct and pointer-based form. Our succinct data structures are further
specialized to be plain or entropy-compressed. Through experiments on large
sets, we show that succinct data structures for path queries may present a
viable alternative to standard pointer-based realizations, in practical
scenarios. Compared to na{\"i}ve approaches that compute the answer by explicit
traversal of the query path, our succinct data structures are several times
faster in path median queries and perform comparably in path counting and path
reporting queries, while being several times more space-efficient. Plain
pointer-based realizations of our data structures, requiring a few times more
space than the na{\"i}ve ones, yield up to -times speed-up over them